# coding:utf-8
# @Time    : 2021/11/3 9:13
# @Author  : Martin

import logging
import os
from logging import config as log_conf
# from functools import wraps


class Logger:

    @staticmethod
    def get_logger():
        work_path = os.path.dirname(os.path.dirname(__file__))
        # 加载配置文件
        log_conf.fileConfig(work_path+'/conf/log.ini')
        # 创建日志生成器
        return logging.getLogger()

# class Logit(object):
#     def __init__(self, logfile='out.log', logger: logging.RootLogger = None):
#         self.logfile = logfile
#         self.logger = logger
#
#     def __call__(self, func):
#         @wraps(func)
#         def wrapped_function(*args, **kwargs):
#             log_string = func.__name__ + " was called"
#             print(log_string)
#             log_conf.fileConfig(self.logfile)
#             self.logger.info("执行参数：{}".format(kwargs))
#             self.notify()
#             return func(*args, **kwargs)
#
#         return wrapped_function
#
#     def notify(self):
#         # logit只打日志，不做别的
#         pass
